<template>
	<view>
		<view class="header status_bar" :class="scrrol == true ? 'scrrolHeader' : ''">
			<view class="back iconfont icon-xiangzuo1" @tap="backPage"></view>
			<view class="text" :class="scrrol == true ? 'scrrolHeader' : ''">{{Lang.lang('邀請好友')}}</view>
			<view class="back"></view>
			<!-- <view class="rule">规则</view> -->
		</view>
		<view class="clear_box"></view>

		<view class="page_content">
			<view class="logo">
				<image src="../../static/bg06.png" mode="widthFix"></image>
			</view>
			<view class="code">
				<image :src="user_info.agent_code_qrcode" mode="widthFix"></image>
			</view>
			<view class="confirm02" @click="copyText(user_info.agent_code_url)">{{Lang.lang('复制链接')}}</view>
			<!-- <view class="confirm02 confirm03">保存图片</view> -->
		</view>



	</view>
</template>

<script>
	export default {
		data() {
			return {
				lang: 'en',
				link: '',
				pupu: false,
				scrrol: false,
				info: '',
				user_info: {
					agent_code_qrcode: '',
					agent_code_url: ''
				}
			}
		},
		onLoad() {

		},
		onShow() {
			let that = this;
			that.loadData();
		},
		methods: {
			loadData() {
				let that = this;
				that.Net._post('api/user/getUserInfo', {}, res => {
					if (res.code == 200) {
						that.user_info = res.data.user_info
					}
				});
			},
			copyText(text) {
				let that = this;
				uni.setClipboardData({
					data: text,
					success: function() {
						// 可以添加用户友好的提示，例如使用uni.showToast提示复制成功
						uni.showToast({
							title: that.Lang.lang('複製成功'),
							icon: 'none',
							duration: 2000
						});
					},
					fail: function() {
						
						// 可以添加错误处理或用户友好的提示
					}
				});
			},
			backPage() {
				uni.navigateBack({});
			},
			gotopage(e) {
				let url = e.currentTarget.dataset.url;
				uni.navigateTo({
					url: url
				});
			},
		},
		onPageScroll: function(Object) {
			//console.log(Object.scrollTop); //实时获取到滚动的值
			if (Object.scrollTop > 28) {
				this.scrrol = true;
				/* #ifdef APP-PLUS */
				/* #endif */
			} else if (Object.scrollTop < 28) {
				this.scrrol = false;
				/* #ifdef APP-PLUS */
				/* #endif */
			}
		},
	}
</script>

<style>
	.header {
		background-color: transparent !important;
	}

	.header .text {
		text-align: center;
	}

	.page_content {
		width: 92%;
		margin: 0 auto;
	}

	.scrrolHeader {
		width: 100%;
		background-color: #1A1A1A !important;

	}

	.logo {
		width: 100%;
	}

	.logo image {
		width: 100%;
	}

	.code {
		width: 60%;
		margin: 8vw auto;
		border: 1px solid #0155FF;
		padding: 7vw;
		border-radius: 4vw;
	}

	.code image {
		width: 100%;
	}

	.confirm03 {
		margin-top: 4%;
		background-color: #238D76;
	}
</style>